import static org.junit.Assert.*;
import models.Event;

import org.junit.Test;
import java.util.*;

import controllers.Events;
import play.test.UnitTest;

public class checkMeeting  extends UnitTest{
	@Test
	public void check()
	{
		GregorianCalendar cal1 =new GregorianCalendar(2010, Calendar.APRIL, 01,2,0);
		GregorianCalendar cal2 =new GregorianCalendar(2011, Calendar.APRIL, 01,2,0);
		GregorianCalendar cal3 =new GregorianCalendar(2010, Calendar.APRIL, 03,2,0);
		GregorianCalendar cal4 =new GregorianCalendar(2010, Calendar.APRIL, 03,3,0);
		GregorianCalendar cal5 =new GregorianCalendar(2010, Calendar.APRIL, 04,2,0);
		GregorianCalendar cal6 =new GregorianCalendar(2010, Calendar.APRIL, 04,5,0);
		GregorianCalendar cal7 =new GregorianCalendar(2010, Calendar.APRIL, 03,2,0);
		GregorianCalendar cal8 =new GregorianCalendar(2010, Calendar.APRIL, 03,3,0);
		Calendar cal9 =new GregorianCalendar().getInstance();
		GregorianCalendar cal10 =new GregorianCalendar(2012, Calendar.APRIL, 04,2,0);
		Event sprint=new Event("Sprint","description","location",cal1,cal2).save();
		Event event1=new Event("Event1","desc","loc",cal3,cal4).save();
		Event event2=new Event("Event2","desc","loc",cal5,cal6).save();
		Event event3=new Event("Event3","desc","loc",cal7,cal8).save();
		Event event4=new Event("Event4","desc","loc",cal9,cal10).save();
		Event event5=new Event("Event5","desc","loc",cal9,cal10).save();
		List<Event> meetings=new ArrayList<Event>();	
		meetings.add(event1);
		meetings.add(event2);
		meetings.add(event3);
		meetings.add(event4);
		meetings.add(event5);
		sprint.events=meetings;
		List<Event> curMeetings=new ArrayList<Event>();
		curMeetings.add(event4);
		curMeetings.add(event5);
		curMeetings.add(sprint);
		meetings=Events.checkForMeeting(sprint);
		System.out.println(sprint.getEntityId()+" "+event4.getEntityId()+" "+event5.getEntityId()+" ");
		assertEquals(curMeetings, meetings);
	}
	

}
